package com.ocom.mqsubsidy.config;

import cn.hutool.core.thread.ExecutorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;

@Configuration
@EnableAsync
public class ThreadPoolConfig {
    @Bean(name = "consPerReportsExecutor")
    public ExecutorService consPerReportsExecutor(){
        return  ExecutorBuilder.create()
                .setCorePoolSize(5)
                .setMaxPoolSize(20)
                .setWorkQueue(new LinkedBlockingQueue<>(100))
                .build();
    }
}
